//
//  OosService.h
//  Oos4ios
//
//  Created by Pablo Gonzalez on 2/21/11.
//

#import <Foundation/Foundation.h>
#import "GDataServiceBase.h"
#import "../Feeds/OosFeed.h"
#import "../Entries/OosEntry.h"
#import "../Queries/OosQuery.h"
#import "IOosAtomServiceCallback.h"
#import <oos4ios/Exceptions/MethodNotImplementedException.h>
#import "../../Constants/PrivateConstants.h"



@interface OosAtomService : GDataServiceBase {
	
	OosQuery *mQuery;
	Class mFeedClass;
    Class mEntryClass;
	
#ifdef OOS_TESTING
	NSURL *mTestURL;
#endif
    
    NSMutableArray *requestQueue;
	
}

#ifdef OOS_TESTING
@property (nonatomic, retain) NSURL *testURL;
- (BOOL) hasTestingURL;
#endif

@property (nonatomic, retain) OosQuery *query;
@property (nonatomic, retain) Class feedClass;
@property (nonatomic, retain) Class entryClass;

+ (OosAtomService *) atomService;

- (GDataServiceTicketBase *) create: (id) entry 
                       withCallback: (id <IOosAtomServiceCallback>) callback;

- (GDataServiceTicketBase *) read: (id <IOosAtomServiceCallback>) callback;
- (GDataServiceTicketBase *) update: (OosEntry *) entry
                       withCallback: (id<IOosAtomServiceCallback>) callback;
- (GDataServiceTicketBase *) deleteEntry: (OosEntry *) entry 
                            withCallback: (id<IOosAtomServiceCallback>) callback;

+ (void) registerTicket: (GDataServiceTicketBase *) ticket 
		   withCallback: (id <IOosAtomServiceCallback>) callback;
+ (void) removeTicket: (GDataServiceTicketBase *) ticket;
+ (void) report: (GDataServiceTicketBase *) ticket withObject: (id) object;
+ (void) report: (GDataServiceTicketBase *) ticket withError: (NSError *) error;
+ (id<IOosAtomServiceCallback>) callbackForTicket: 
		(GDataServiceTicketBase *) ticket;

- (void) ticket:(GDataServiceTicketBase *)ticket 
finishedWithObject:(GDataObject *)object 
          error:(NSError *)error;

@end
